#{if _mode == 'display' }
	<table id="missions_table">
		<thead>
			<tr>
				<th></th>
				<th>Titre</th>
				<th>Description</th>
				<th>Client</th>
				<th>Date Début</th>
				<th>Date Fin</th>
			</tr>
		</thead>
		<tbody>
			#{list items: _collaborator.getValidProfile().getMissions(), as:'mission' }
				<tr>
					<td>
						<img src="http://datatables.net/examples/examples_support/details_open.png" alt="expand" 
						onclick="expandMission(this, ${mission.getMissionID()});"/>
						#{if _canEdit == true}
							<img src="http://www.bloggingbistro.com/wp-content/uploads/2011/03/Delete-Icon.png" width="20px" alt="expand" 
							onclick="deleteMission(${mission.getMissionID()}, '${mission.getTitle().escapeJavaScript().escapeHtml()}');"/>
							<img src="http://cdn1.iconfinder.com/data/icons/icojoy/shadow/standart/png/24x24/001_45.png" width="20px" alt="expand" 
							onclick="showUpdateMissionPanel(${mission.getMissionID()});"/>
						#{/if}
					</td>
					<td>${mission.getTitle()}</td>
					<td>${mission.getDescription().raw()}</td>
					<td>${mission.getClient().getName()}</td>
					<td>${_tools.getDateAsString(mission.getStartDate())}</td>
					<td>${_tools.getDateAsString(mission.getEndDate())}</td>
				</tr>
			#{/list}
		</tbody>
	</table>
#{/if}

#{if _mode == 'display_pdf' }
	#{list items: _collaborator.getValidProfile().getMissions(), as:'mission' }
		<div>
			<div class="left_mission">
				${mission.getClient().getName()}<br/>
				<span>${_tools.getDateAsString(mission.getStartDate())} à ${_tools.getDateAsString(mission.getEndDate())}<span> 
			</div>
			<div class="right_mission">
				<span>${mission.getTitle()}</span>
				<br/><br/>
				${mission.getDescription().raw()}
			<br/> 
			</div>
			<div class="left_tech_env">	
				<br/>
				Environnement technique
			</div> 
			<div class="right_tech_env">
				<br/>	
                ${mission.getMissionSkills().join(' / ')}<br/>
				<br/>
			</div>
			<hr/>	
			<br/>
		</div>
	#{/list}
#{/if}

#{if _mode == 'add'}
	#{form @Collaborator.addMission(_collaborator.getCollaboratorID()), method:'POST', id:'addMissionForm', enctype:'multipart/form-data' }
		#{field 'missionTitle'}
	      	<label>Titre</label>
	        <input type="text" size="50" id="${field.id}" name="${field.name}" />
		#{/field}		
		<br/>
		
		<label>Client</label>
		#{select 'clientID', items:_clients, valueProperty:'clientID', labelProperty:'name', value:1, id:'clientID' /}
		<br/>
		
		#{field 'missionStartDate'}
	      	<label>Date début</label>
	        <input type="text" size="10" id="${field.id}" name="${field.name}" />
		#{/field}
		<br/>
		
		#{field 'missionEndDate'}
	      	<label>Date fin</label>
	        <input type="text" size="10" id="${field.id}" name="${field.name}" />
		#{/field}	
		<br/>
		
		#{field 'missionDescription'}
	      	<label for="${field.name}">Description</label>
	        <textarea rows="5" id="${field.id}" name="${field.name}"></textarea>
		#{/field}	
		<br/>
		
		<label for="mission_skills_panel">Competences</label>
		<img src="@{'/public/images/plus.jpg'}" alt="plus" width="25px" onclick="javascript:addMissionSkillInput()"/>
		<img src="@{'/public/images/minus.jpg'}" alt="minus" width="25px" onclick="javascript:removeMissionSkillInput()"/>
		
		<div id="mission_skills_panel">
			<input type="hidden" name="missionSkillsList" id="missionSkillsList" value=""/>		
		</div>
		<br/>
	#{/form}
	<button id="add_mission_button" onclick="javascript:submitMissionForm()">Ajouter Mission</button>
#{/if}

#{if _mode == 'edit'}
	#{form @Collaborator.updateMission(), method:'POST', id:'updateMissionForm', enctype:'multipart/form-data' }
		<input type="hidden" id="updateMissionID" name="updateMissionID"/>
		#{field 'updateMissionTitle'}
	      	<label>Titre</label>
	        <input type="text" size="50" id="${field.id}" name="${field.name}" />
		#{/field}		
		<br/>
		
		<label>Client</label>
		#{select 'updateClientID', items:_clients, valueProperty:'clientID', labelProperty:'name', value:1, id:'updateClientID' /}
		<br/>
		
		#{field 'updateMissionStartDate'}
	      	<label>Date début</label>
	        <input type="text" size="10" id="${field.id}" name="${field.name}" />
		#{/field}
		<br/>
		
		#{field 'updateMissionEndDate'}
	      	<label>Date fin</label>
	        <input type="text" size="10" id="${field.id}" name="${field.name}" />
		#{/field}	
		<br/>
		
		#{field 'updateMissionDescription'}
	      	<label for="${field.name}">Description</label>
	        <textarea id="${field.id}" name="${field.name}"></textarea>
		#{/field}	
		<br/>
		
		<label for="update_mission_skills_panel">Competences</label>
		<img src="@{'/public/images/plus.jpg'}" alt="plus" width="25px" onclick="javascript:addUpdateMissionSkillInput()"/>
		<img src="@{'/public/images/minus.jpg'}" alt="minus" width="25px" onclick="javascript:removeUpdateMissionSkillInput()"/>
		
		<div id="update_mission_skills_panel">
			<input type="hidden" name="updateMissionSkillsList" id="updateMissionSkillsList" value=""/>		
		</div>
		<br/>
	#{/form}
	<button id="update_mission_button" onclick="javascript:updateMission()">Modifier Mission</button>
#{/if}
